package com.hyk.utils;

import com.hyk.entity.User;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;
import java.util.LinkedHashMap;

public class UserUtils {

    public static LinkedHashMap getUser(){
        HttpServletRequest request = ((ServletRequestAttributes)
                RequestContextHolder.
                        currentRequestAttributes()).
                getRequest();
        LinkedHashMap user = (LinkedHashMap) request.getAttribute("user");
        Class<User> userClass = User.class;

        return user;
    }

}
